const config = require('../../config.js')
Page({

  data: {
      user:{},
    // balance:0.00,
    // score:0,
    // username:"未登录",
    // userInfo: {},
    // userimg:"../../image/skd.jpg",
    // hasUserInfo: false,
    // canIUse: wx.canIUse('button.open-type.getUserInfo'),
    // arrow:"../../image/0106arrow3x.png",

    // 1.菜单栏数据
    items: [
      {
        icon: '../../image/shoucang.png',
        text: '我的收藏',
        url: '../example/collect/collect'
      },
      {
        icon: '../../icon/friend.png',
        text: '审核信息',
        url: '../example/info/info'
      },


      {
        icon: '../../image/qiandao.png',
        text: '我的课程',
        url: "/pages/coursedetail/index"
      },

      {
        icon: '../../icon/my.png',
        text: '个人信息',
        url: "../example/user/index"
      },
      {
        icon: '../../image/yijan.png',
        text: '意见反馈',
        url: '../example/fdback/fdback'
      },
    ]

  },
  gotopage: function (event) {
    wx.navigateTo({
      url: event.currentTarget.dataset.hi
    })
  },
  goAsset: function () {
    wx.navigateTo({
      url: "/pages/asset/index"
    })
  },
  goScore: function () {
    wx.navigateTo({
      url: "/pages/score/index"
    })
  },

  /**
   * 获取用户信息
   */
  getUserInfo: function (e) {
    wx.request({
      url: `${config.baseUri}/user/${config.userId}`,
      method: 'GET',
      success: (res) => {
        console.log(res);
        this.setData({
         user: res.data.data
        })
      }
    })
  },

  onLoad: function (options) {
    this.getUserInfo();
  },
  //事件处理函数
  bindViewTap: function () {

  }
})